﻿using System;
using DataBaseLibrary.DBObjectsFB;

namespace DocMreoLiteVersion.Reports.DeclarationReport
{
    //TODO: Возможно, так организовывать класс для привязки отчёта к данным - тупость. Когда придумаю умнее - переделать!
    //TODO: Умнее врят ли будет!!!

    public class DataDeclarationReportBinding
    {
        public String DateDeclarationCreateContract { get; set; } //Дата создания договора!
        public String NumberDeclarationContract { get; set; }//Номер созданного договора!

        public String NameRegistrationDevision { get; set; }

        public int Action { get; set; }

        //Информация о Собственнике
        public String LastNameOwner { get; set; }
        public String FirstNameOwner { get; set; }
        public String PatronymicOwner { get; set; }
        public String DateOfBirthOwner { get; set; }
        public String TinOwner { get; set; }
        public String PhoneNumberOwner { get; set; }
        public String eMailOwner { get; set; }
        //Паспортные данные
        public String SerialOwner { get; set; }
        public String NumberOwner { get; set; }
        public String DateIssuePassportOwner { set; get; }
        public String PassportIssuedByOwner { get; set; }
        //Адрес покупателя
        public String CityOwner { get; set; }
        public String StreetOwner { get; set; }
        public String NumberBuildingOwner { get; set; } //Номер корпуса
        public String NumberFlatOwner { get; set; } //Номер квартиры
        public String NumberHomeOwner { get; set; } //Номер дома
        public String ResidentialAreaOwner { get; set; } //Область, край


        //Информация о представителе
        public String LastNameRepresentative { get; set; }
        public String FirstNameRepresentative { get; set; }
        public String PatronymicRepresentative { get; set; }
        public String DateOfBirthRepresentative { get; set; }
        public String PhoneNumberRepresentative { get; set; }

        //Доверенность
        public String ProxyNumber { get; set; }
        public String ProxyDateIssue { get; set; }
        public String ProxyIssuedBy { get; set; }

        //Паспортные данные
        public String SerialRepresentative { get; set; }
        public String NumberRepresentative { get; set; }
        public String DateIssuePassportRepresentative { set; get; }
        public String PassportIssuedByRepresentative { get; set; }
        //Адрес представителя
        public String CityRepresentative { get; set; }
        public String StreetRepresentative { get; set; }
        public String NumberBuildingRepresentative { get; set; }
        public String NumberFlatRepresentative { get; set; }
        public String NumberHomeRepresentative { get; set; }
        public String ResidentialAreaRepresentative { get; set; }

        //Информация о ТС
        public String CostMachine { get; set; }
        public String CostMachineString { get; set; }

        public String RegZnak { get; set; }
        public String VIN { get; set; }
        public String DopVIN { get; set; }
        public String Model { get; set; }
        public String Shassi { get; set; }
        public String Kuzov { get; set; }
        public String ColorM { get; set; }
        public String TypeTC { get; set; }
        public String YeahrManufacturing { get; set; }
        public String CategoryTC { get; set; }

        public Double PowerTC { get; set; } //Мощность ТС (л.с.)
        public Double RazreshMass { get; set; } //Разрешенная масса
        public Double MassaBN { get; set; } //Масса без нагрузки

        public String PTC_series { get; set; }
        public String PTC_number { get; set; }
        public String PTC_issued_by { get; set; }
        public String PTC_date_issued { get; set; }


        

        public String NumberRegContr { get; set; }
        public String SeriesRegContr { get; set; }
        public String DateIssueRegContr { get; set; }
        
        public String NumberInsComp { get; set; }
        public String SeriesInsComp { get; set; }
        public String DateIssueInsComp { get; set; }
        public String IssuedByInsComp { get; set; }

        
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="declarationContract"></param>
        /// <param name="IsPrintRegContract"></param>
        public DataDeclarationReportBinding(Application declarationContract)
        {

            DateDeclarationCreateContract = declarationContract.DateCreateContract.ToString("d");

            NumberDeclarationContract = declarationContract.NumberDeclarationContract;

            NameRegistrationDevision = declarationContract.NameRegistrationDevision;

            Action = declarationContract.Action;

            //Заполнение данных о Собственнике
            LastNameOwner = declarationContract.Owner.LastName;
            FirstNameOwner = declarationContract.Owner.FirstName;
            PatronymicOwner = declarationContract.Owner.Patronymic;
            DateOfBirthOwner = declarationContract.Owner.DateOfBirth == null ? "" : ((DateTime)declarationContract.Owner.DateOfBirth).ToString("d");
            SerialOwner = declarationContract.Owner.PassportSeries;
            NumberOwner = declarationContract.Owner.PassportNumber;
            DateIssuePassportOwner = declarationContract.Owner.PassportDateIssue == null ? "" : ((DateTime)declarationContract.Owner.PassportDateIssue).ToString("d");
            PassportIssuedByOwner = declarationContract.Owner.PassportIssuedBy;

            TinOwner = declarationContract.Owner.TIN;
            PhoneNumberOwner = declarationContract.Owner.PhoneNumber;
            eMailOwner = declarationContract.Owner.EMail;

            CityOwner = declarationContract.Owner.Address.City;
            StreetOwner = declarationContract.Owner.Address.Street;
            NumberBuildingOwner = declarationContract.Owner.Address.NumberBuilding;
            NumberFlatOwner = declarationContract.Owner.Address.NumberFlat;
            NumberHomeOwner = declarationContract.Owner.Address.NumberHome;
            ResidentialAreaOwner = declarationContract.Owner.Address.ResidentialArea;

            //Заполнение данных о представителе
            LastNameRepresentative = declarationContract.Representative.OIndividual.LastName;
            FirstNameRepresentative = declarationContract.Representative.OIndividual.FirstName;
            PatronymicRepresentative = declarationContract.Representative.OIndividual.Patronymic;
            DateOfBirthRepresentative = declarationContract.Representative.OIndividual.DateOfBirth == null ? "" : ((DateTime)declarationContract.Representative.OIndividual.DateOfBirth).ToString("d");
            SerialRepresentative = declarationContract.Representative.OIndividual.PassportSeries;
            NumberRepresentative = declarationContract.Representative.OIndividual.PassportNumber;
            DateIssuePassportRepresentative = declarationContract.Representative.OIndividual.PassportDateIssue == null ? "" : ((DateTime)declarationContract.Representative.OIndividual.PassportDateIssue).ToString("d");
            PassportIssuedByRepresentative = declarationContract.Representative.OIndividual.PassportIssuedBy;

            CityRepresentative = declarationContract.Representative.OIndividual.Address.City;
            StreetRepresentative = declarationContract.Representative.OIndividual.Address.Street;
            NumberBuildingRepresentative = declarationContract.Representative.OIndividual.Address.NumberBuilding;
            NumberFlatRepresentative = declarationContract.Representative.OIndividual.Address.NumberFlat;
            NumberHomeRepresentative = declarationContract.Representative.OIndividual.Address.NumberHome;
            ResidentialAreaRepresentative = declarationContract.Representative.OIndividual.Address.ResidentialArea;

            PhoneNumberRepresentative = declarationContract.Representative.OIndividual.PhoneNumber;
            ProxyNumber = declarationContract.Representative.NumberProxy;
            ProxyDateIssue = declarationContract.Representative.DateIssue == null ? "" : ((DateTime)declarationContract.Representative.DateIssue).ToString("d");
            ProxyIssuedBy = declarationContract.Representative.IssueBy;



            //Инфа о ТС
            RegZnak = declarationContract.Vehicle.ORegistrInformation.StateRoom;
            VIN = declarationContract.Vehicle.VIN;
            DopVIN = declarationContract.Vehicle.ORegistrInformation.DopVin;
            Model = declarationContract.Vehicle.ModelVehicle;
            Shassi = declarationContract.Vehicle.OTechnicalCharacteristics.NumberChassis;
            Kuzov = declarationContract.Vehicle.OTechnicalCharacteristics.NumberCarcass;
            ColorM = declarationContract.Vehicle.OTechnicalCharacteristics.Color;
            TypeTC = declarationContract.Vehicle.TypeVehicle;
            YeahrManufacturing = declarationContract.Vehicle.YearManufacture == null ? "" : ((DateTime)declarationContract.Vehicle.YearManufacture).Year.ToString();
            CategoryTC = declarationContract.Vehicle.Category;

            RazreshMass = declarationContract.Vehicle.OTechnicalCharacteristics.AllowableWeight;
            MassaBN = declarationContract.Vehicle.OTechnicalCharacteristics.UnladenMass;
            PowerTC = declarationContract.Vehicle.OTechnicalCharacteristics.PowerDriver;



            NumberRegContr = declarationContract.Vehicle.ORegistrInformation.NumberRegistrSert;
            SeriesRegContr = declarationContract.Vehicle.ORegistrInformation.SeriesRegistrSert;
            DateIssueRegContr = declarationContract.Vehicle.ORegistrInformation.DateRegistrSert == null
                                    ? ""
                                    : ((DateTime)declarationContract.Vehicle.ORegistrInformation.DateRegistrSert).ToString("d");

            NumberInsComp = declarationContract.Vehicle.ORegistrInformation.NumberInsuranceCompany;
            SeriesInsComp = declarationContract.Vehicle.ORegistrInformation.SeriesInsuranceCompany;
            DateIssueInsComp = declarationContract.Vehicle.ORegistrInformation.DateInsuranceCompany == null ? "" : ((DateTime)declarationContract.Vehicle.ORegistrInformation.DateInsuranceCompany).ToString("d");
            IssuedByInsComp = declarationContract.Vehicle.ORegistrInformation.IssuedByInsuranceCompany;


            PTC_series = declarationContract.Vehicle.ORegistrInformation.SeriesPts;
            PTC_number = declarationContract.Vehicle.ORegistrInformation.NumberPts;
            PTC_issued_by = declarationContract.Vehicle.ORegistrInformation.IssueByPts;
            PTC_date_issued = declarationContract.Vehicle.ORegistrInformation.DateIssuePts == null ? "" : ((DateTime)declarationContract.Vehicle.ORegistrInformation.DateIssuePts).ToString("d");

        }
    }
}
